Call Store
Audio/video call management APIs for initiating, answering, rejecting, hanging up calls, group call management, and call history management.
Overview
CallStore Manages all audio/video call related operations, including initiating, answering, rejecting, hanging up, group call management, and call history management. Audio/video call functionality is implemented through CallStore for real-time audio/video interaction between users. CallStore provides a comprehensive set of APIs to manage the entire call lifecycle.
Key Features
Create Audio/Video Calls:Support initiating audio or video calls to one or multiple users, with configurable timeout, custom data, and other parameters
Answer/Reject Audio/Video Calls:When receiving an incoming call invitation, you can choose to answer or reject
Hang Up Audio/Video Calls:End the current ongoing audio/video call
Group Call Management:Support joining existing group calls or inviting other users to join during a call
Call History Management:Query recent call records (with pagination support), delete specified call records
Event-Driven Architecture:Provides event listeners for call started, call received, call ended, etc.
State Subscription:Real-time subscription to current call state, including participant list, volume information, network quality, etc.
Important: Ensure the SDK is initialized before accessing the CallStore.shared singleton. Do not instantiate it directly, as doing so will prevent you from receiving call state updates.
Tip: Call state updates are delivered through the callState publisher. Subscribe to it to receive real-time updates of call data.
Call Operations Overview
The following table shows the main call operations
| Feature | Method | Description |
| Create Call | calls | Create an audio or video call to specified users |
| Answer Call | accept | Answer an incoming call |
| Reject Call | reject | Reject an incoming call |
| Hang Up Call | hangup | Hang up the current call |
| Join Call | join | Actively join a group call |
| Invite Users | invite | Invite other users to join the current call |
Call History Management
| Feature | Method | Description |
| Query Records | queryRecentCalls | Query recent call records (with pagination support) |
| Delete Records | deleteRecentCalls | Delete specified call records |
Usage Example
import io.trtc.tuikit.atomicxcore.api.call.*
// Create a video call
CallStore.shared.calls(
participantIds = listOf("mike"),
callMediaType = CallMediaType.VIDEO,
params = null
) { code, message ->
}Warning: Please ensure proper handling of UI state after the call ends to avoid UI anomalies.
Topics
Get Instance
CallStore.shared - Get the CallStore singleton instance
Observe State and Events
observerState - Reactive state containing active call, participant list, volume information, and network quality
addListener/removeListener - Call event publisher
Call Operations
calls - Create a call
accept - Answer a call
reject - Reject a call
hangup - Hang up a call
join - Join a group call
invite - Invite users to join a call
Call History
queryRecentCalls - Query recent call records
deleteRecentCalls - Delete call records
See Also
Properties
Functions
Answer a call. Call this method to answer the call when receiving an incoming call invitation.
Add call event callback listener
Create an audio or video call to specified users, supporting both one-on-one and group calls.
Delete specified call records.
Hang up and end the current ongoing call.
Invite other users to join during an ongoing call.
Join an ongoing group call using a specific call ID.
Query recent call records with pagination support. Pass an empty string as the initial cursor. For subsequent requests, use the cursor returned in the previous response to fetch the next page. Results are updated asynchronously in state.recentCalls.
Reject a call. Call this method to reject the call when receiving an incoming call invitation.
Remove call event callback listener